
Ext.define('Holo.model.SpotDescription', {
    extend: 'Ext.data.Model',

    idProperty: 'id',

    fields: [
        {
            name: 'id',
            type: 'int'
        },
        {
            name: 'spot_id',
            type: 'int'
        },
        {
            name: 'type',
            type: 'string'
        },
        {
            name: 'language',
            type: 'string'
        },
        {
            name: 'title',
            type: 'string'
        },
        {
            name: 'text',
            type: 'string'
        }
    ],

    associations: [{
           type: 'belongsTo',
           model: 'Holo.model.Spot',
           foreignKey:'spot_id'
    }],
         
    proxy: {
        type: 'ajax',
        api: {
            create: 'database/controller.php?MODEL=spotdescription&ACTION=ADD',
            read: 'database/controller.php?MODEL=spotdescription&ACTION=LST',
            update: 'database/controller.php?MODEL=spotdescription&ACTION=UPD',
            destroy: 'database/controller.php?MODEL=spotdescription&ACTION=DEL'
        },
        
        reader: {
            type: 'json',
            root: 'data'
        },
        
        writer : {
            type: 'json',
        	allowSingle  : false,
        	root: 'data',
        	encode : true
        }
    }
});